Skip to content

feat(id/idset): exact Admin role at the frontier (#6798) - #6833

Merged
developing-today[bot] merged 1 commit into
mainfrom
queue/6798-exact-admin-role
Nov 7, 2026
Merged

developing-today[bot] merged 1 commit into
mainfrom
queue/6798-exact-admin-role

Conversation

@developing-today

@developing-today developing-today Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6798 (follow-up to #4998 / PR #6787, from the Codex P2 exactness half).

What changed

pkgs/id/src/idset/expand.rs:

  • Expander::new now takes an AdminsAtPosition source beside the membership layer: Fn(&[Hash frontier], Hash group) -> BTreeSet<AuthorKey> — the author keys holding the Admin policy role in that group at that frontier. The model implementation is the groups fold's admins_at_position replay; a caller adapts it by closing over its fold state and event index.
  • group_members upgrades members the source names to Role::Admin in the pinned snapshot (admin status never creates membership — a named non-member stays absent).
  • clamp_admin_thresholds and has_admin_threshold are deleted: Admin thresholds are evaluated as written. A source with no admin data fails closed (Admin admits nobody) instead of silently widening to Manage — the pre-id(writer-set): exact Admin role at the frontier — plumb fold admin state into expansion (follow-up to #4998) #6798 clamped behaviour is gone, not just bypassed.
  • Module doc rewritten for the exactness contract; the §4.5 cache key is unchanged (the source is fixed per expander/resolution epoch).

Tests — oracle: the membership layer fed a known causal history, as the suite already works

cargo test --test writer_set_expansion (pkgs/id): 15 passed, 0 failed.

  • The pinned clamp test is replaced by test_expand_role_min_admin_without_admin_data_admits_nobody (fail-closed baseline; Manage still answered exactly by the layer).
  • test_expand_role_min_admin_admits_admin_not_non_admin_manager — Alice (admin per source) admitted by an Admin entry; Erin, a non-admin manager, is not (a Manage entry at the same frontier admits both, proving the distinction did the work).
  • test_expand_role_min_admin_promoted_after_frontier_is_not_admitted — Erin's Admin exists only at the later frontier in the source's answer; the earlier pinned version admits nobody, the later one admits Erin (Admin analogue of spec test 6).
  • All seven spec tests + the three proptests still pass; rustfmt diffs vs baseline: none added (the 3 reported are pre-existing under stock rustfmt settings).

Implemented by lane code-b in fallback mode (queue backend down, code#6619), claimed on #6798.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…admin-at-frontier source (#6798)

The membership layer records Admin as Manage, so expand() clamped every Admin role_min to Manage: an Admin-threshold admission (and exclusion) was broader than the set author wrote. The Expander now takes an AdminsAtPosition source beside Membership::members_at_position (modelled on the groups fold admins_at_position replay): members the source names at the pinned frontier are marked Role::Admin in the snapshot, clamp_admin_thresholds is deleted, and a source with no admin data fails closed (Admin admits nobody) instead of widening to Manage.

Tests (writer_set_expansion, 15/15): the pinned clamp test is replaced by a fail-closed baseline; new tests pin an admin admitted while a non-admin manager is not, and a member promoted to Admin only after the frontier not admitted by the earlier version.
@developing-today
developing-today Bot requested review from a team and dezren39 as code owners November 7, 2026 06:19
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 03e43e7f-1701-4669-ae02-38d3b586ea79

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(writer-set): exact Admin role at the frontier — plumb fold admin state into expansion (follow-up to #4998)

0 participants